#ifndef _MAIN
#define _MAIN
#include <Windows.h>
#include <math.h>
#include <gl\GL.h>
#include <gl\GLU.h>
#include <CommCtrl.h>
#include <stdio.h>
#include <time.h>
#include <wchar.h>
#pragma comment (lib,"opengl32.lib")
#pragma comment (lib,"glu32.lib")
#pragma comment (lib,"comctl32.lib")
#pragma comment (lib,"imm32.lib")
#define CLIENTWIDTH 1100
#define CLIENTHEIGHT 600
#define GLWINDOWWIDTH 800
#define GLWINDOWHEIGHT 600
#define TITLEX 0
#define TITLEY 10
#define TITLEWIDTH CLIENTWIDTH-GLWINDOWWIDTH
#define TITLEHEIGHT 25
#define BSTITLEX 3
#define BSTITLEY 40
#define BSX 0
#define BSY TITLEHEIGHT+BSTITLEY+60
#define BSWIDTH CLIENTWIDTH-GLWINDOWWIDTH-1-BSX
#define BSHEIGHT 140
#define BSADDBTNX 180
#define BSADDBTNY BSTITLEY+54
#define BSADDBTNWIDTH 50
#define BSADDBTNHEIGHT 28
#define BSADDRANDOMBTNX BSADDBTNX+BSADDBTNWIDTH+2
#define BSADDRANDOMBTNY BSADDBTNY
#define BSADDRANDOMBTNWIDTH 65
#define BSADDRANDOMBTNHEIGHT 28
#define BSHINTX 3
#define BSHINTY BSTITLEY+30
#define BSHINTWIDTH BSADDBTNX-BSHINTX-1
#define BSHINTHEIGHT 20
#define BSXYZX 3
#define BSXYZY 63+BSTITLEY
#define BSXYZSPACING 60
#define BSEDITX 20
#define BSEDITY 59+BSTITLEY
#define BSEDITWIDTH 35
#define BSEDITHEIGHT 23
#define TNTITLEX 3
#define TNTITLEY 270
#define TNXYZX 3
#define TNXYZY 35+TNTITLEY
#define TNXYZSPACING 60
#define TNEDITX 20
#define TNEDITY 31+TNTITLEY
#define TNEDITWIDTH 35
#define TNEDITHEIGHT 23
#define TNLOCKWIDTH 50
#define TNLOCKHEIGHT 28
#define TNLOCKX 180
#define TNLOCKY TNEDITY-TNLOCKHEIGHT+TNEDITHEIGHT
#define TNLOCKRANDOMX TNLOCKX+TNLOCKWIDTH+2
#define TNLOCKRANDOMY TNLOCKY
#define TNLOCKRANDOMWIDTH 65
#define TNLOCKRANDOMHEIGHT 28
#define SETTINGTITLEX 3
#define SETTINGTITLEY 340
#define SETTINGTEMPHINTX 3
#define SETTINGTEMPHINTY SETTINGTITLEY+30
#define SETTINGTEMPHINTWIDTH 100
#define SETTINGTEMPHINTHEIGHT 20
#define SETTINGTEMPEDITX SETTINGTEMPHINTX+SETTINGTEMPHINTWIDTH
#define SETTINGTEMPEDITY SETTINGTEMPHINTY-5
#define SETTINGTEMPEDITWIDTH 40
#define SETTINGTEMPEDITHEIGHT 23
#define SETTINGWINDSPEEDHINTX SETTINGTEMPHINTX+150
#define SETTINGWINDSPEEDHINTY SETTINGTEMPHINTY
#define SETTINGWINDSPEEDHINTWIDTH SETTINGTEMPHINTWIDTH
#define SETTINGWINDSPEEDHINTHEIGHT SETTINGTEMPHINTHEIGHT
#define SETTINGWINDXYZHINTX 3
#define SETTINGWINDXYZHINTY SETTINGTEMPHINTY+20
#define SETTINGWINDXYZHINTWIDTH 300
#define SETTINGWINDXYZHINTHEIGHT 20
#define SETTINGWINDXYZX 3
#define SETTINGWINDXYZY 415
#define SETTINGWINDSPEEDEDITX SETTINGWINDSPEEDHINTX+SETTINGWINDSPEEDHINTWIDTH
#define SETTINGWINDSPEEDEDITY SETTINGWINDSPEEDHINTY-5
#define SETTINGWINDSPEEDEDITWIDTH 40
#define SETTINGWINDSPEEDEDITHEIGHT 23
#define SETTINGWINDXYZSPACING 45
#define SETTINGWINDXYZEDITX 20
#define SETTINGWINDXYZEDITY 410
#define SETTINGWINDXYZEDITWIDTH 25
#define SETTINGWINDXYZEDITHEIGHT 23
#define RESULTTITLEX 3
#define RESULTTITLEY 440 
#define RESULTX 3
#define RESULTY 465
#define RESULTWIDTH 280
#define RESULTHEIGHT 60
#define LOCATEX 30
#define LOCATEHEIGHT 40
#define LOCATEY CLIENTHEIGHT-LOCATEHEIGHT-25
#define LOCATEWIDTH TITLEWIDTH-2*LOCATEX

#define MAX_LOADSTRING 100

#define COLOR_BKGND RGB(234, 234, 234)
#define COLOR_BASESTATIONBKGND RGB(250,250,250)
#define COLOR_BASESTATIONPEN RGB(192,192,192)
#define COLOR_RED RGB(255,0,0)
#define COLOR_GREEN RGB(0,255,0)
#define COLOR_BLUE RGB(0,0,255)
#define COLOR_LTGREEN RGB(213,255,213)
#define COLOR_LTBLUE RGB(213,255,255)
#define COLOR_LTGRAY RGB(213,213,213)
#define COLOR_WHITE RGB(255,255,255)
#define COLOR_PURPLE RGB(255,0,255)
#define COLOR_SCROLLBARSELECTED RGB(240,240,240)
#define COLOR_DKBLUE RGB(0,0,128)
#define COLOR_BSTITLECLR RGB(96,96,96)

#define STANDARDWAVESPEED 340
#define MAX_BASESTATIONCNT 200
#define PI 3.14159265358979323846
#define SCROLLSTEP 20
#define MOVESTEP 5
#define MAX_SCALE_LEVEL 70
#define M 5
#define N 5
#define M2 50
#define N2 50

#define IDC_BSEDITX 10000
#define IDC_BSEDITY 10001
#define IDC_BSEDITZ 10002
#define IDC_BSADD 10003
#define IDC_TNEDITX 10004
#define IDC_TNEDITY 10005
#define IDC_TNEDITZ 10006
#define IDC_TNLOCK 10007
#define IDC_LOCATE 10008
#define IDC_SETTINGWINDEDITX 10009
#define IDC_SETTINGWINDEDITY 10010
#define IDC_SETTINGWINDEDITZ 10011
#define IDC_SETTINGTEMPEDIT 10012
#define IDC_SETTINGWINDSPEEDEDIT 10013
#define IDC_BSADDRANDOM 10014
#define IDC_TNLOCKRANDOM 10015


typedef struct _TAGBS {
	float x;
	float y;
	float z;
	float tdoa;
	float dis;
	float disReal;
}BS, *LPBS;
typedef struct _TAGTN {
	float x;
	float y;
	float z;
}TN, *LPTN;
typedef struct _TAGENV
{
	float temp;
	float windspeed;
	float windx, windy, windz;
}ENV,*LPENV;
typedef struct _TAGMAT
{
	int row;
	int column;
	float* data;
}MAT, *LPMAT;
extern INT baseStationsCnt;
extern INT scrollBarSelectedIndex;
extern BS baseStations[MAX_BASESTATIONCNT];
extern TN testNodeReal, testNodePredict;
extern BOOL bTestNodeReal, bTestNodePredict;
extern ENV env;
extern HWND hMainWindow;
#endif
